<template>
  <a-form :form="form">
    <a-form-item
      :label="item.name"
      :required="item.required"
      v-for="(item, index) in formData"
      :key="index"
    >
      <a-select
        :showSearch="true"
        :mode="item.name === '会签' ? 'multiple' : ''"
        placeholder="请选择处理人"
        style="width: 79.1%;"
        v-decorator="[ item.oid, { rules: [{ required: item.required, message: `请选择${item.name}处理人！` }] }]"
        @change="handleChange"
        :key="new Date().getTime() + '1'"
        filter-option-prop="children"
        :filter-option="filterOption"
        :allowClear="true"
      >
        <a-select-option
          v-for="(item, index) in item.selsectData"
          :key="index"
          :value="item.id"
          >{{ item.fullname }}
        </a-select-option>
      </a-select>
    </a-form-item>
  </a-form>
</template>
<script>
export default {
  data() {
    return {
    };
  },
  props: {
    formData: {
      type: Array,
      default: () => [],
    },
  },
  beforeCreate() {
    this.form = this.$form.createForm(this);
  },
  watch:{
    formData(v1){
      this.formData = v1;
    }
  },
  methods: {
    handleChange() {
    },
    //模糊搜索方法
    filterOption(input,option){
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
  },
};
</script>
<style lang="less" scoped>
.ant-form {
  .ant-form-item {
    margin-bottom: 12px;
    display: flex;
    /deep/ .ant-form-item-label {
      padding-right: 30px;
      text-align: right;
      width: 80px;
      font-size: 14px;
      font-weight: 400;
      box-sizing: border-box;
      & > label {
        color: #666666;
      }
    }
  }
}
</style>